Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

riscv: add a return value to riscv_swint #13564

Merged
merged 1 commit into from
Sep 22, 2024
Merged

Conversation

hujun260
Copy link
Contributor

Summary

add a return value to riscv_swint indicating whether a context switch is required

This commit fixes the regression from #13561

Impact

Testing

ostest

@github-actions github-actions bot added Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Size: S The size of the change in this PR is small labels Sep 21, 2024
@nuttxpr
Copy link

nuttxpr commented Sep 21, 2024

[Experimental Bot, please feedback here]

Yes, the PR appears to meet the NuttX requirements.

Here's a breakdown:

  • Summary: Clearly explains the "why" (fixing a regression), "what" (adding a return value to a specific function), and "how" (referencing the original PR that caused the regression). It also links to the original PR.
  • Impact: While lacking details, it implies minimal impact since it's a fix for a regression. More specifics about the impact (e.g., on compatibility) would strengthen this section.
  • Testing: Provides basic testing information (platform: ostest). Including testing logs before and after the change would significantly improve the thoroughness of this section.

Recommendations for Improvement:

  • Impact: Expand on the potential impact areas. Even if the impact is minimal, explicitly stating this helps reviewers. For example:
    • Compatibility: "This change only affects internal scheduling logic and has no backward or forward compatibility impact."
    • Hardware/Build: "No changes to hardware or build process are required."
  • Testing:
    • Include actual "before" and "after" testing logs to demonstrate the fix.
    • If possible, test on more than one platform or configuration to increase confidence.

Overall: The PR provides a good starting point. Adding the recommended details will ensure a smoother review process and increase the likelihood of a quick merge.

Copy link
Member

@lupyuen lupyuen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OSTest seems to hang at vfork() for rv-virt:knsh? https://gist.github.com/lupyuen/8daee1123a52e222fb601287a00af149

$ git clone https://github.com/hujun260/nuttx --branch apache_10 nuttx
$ tools/configure.sh rv-virt:knsh
...
$ qemu-system-riscv32 -semihosting -M virt,aclint=on -cpu rv32 -kernel nuttx -bios opensbi-1.5-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin -nographic
QEMU emulator version 9.0.2
OpenSBI v1.5
...
nsh> ostest
user_main: vfork() test
[Hangs here]

Update: rv-virt:knsh64 also hangs at vfork(): https://gist.github.com/lupyuen/ce2e2cb328073d25743adbd4bc4a9b87

… switch is required

This commit fixes the regression from apache#13561

Signed-off-by: hujun5 <[email protected]>
@hujun260
Copy link
Contributor Author

OSTest seems to hang at vfork() for rv-virt:knsh? https://gist.github.com/lupyuen/8daee1123a52e222fb601287a00af149

$ git clone https://github.com/hujun260/nuttx --branch apache_10 nuttx
$ tools/configure.sh rv-virt:knsh
...
$ qemu-system-riscv32 -semihosting -M virt,aclint=on -cpu rv32 -kernel nuttx -bios opensbi-1.5-rv-bin/share/opensbi/ilp32/generic/firmware/fw_dynamic.bin -nographic
QEMU emulator version 9.0.2
OpenSBI v1.5
...
nsh> ostest
user_main: vfork() test
[Hangs here]

Update: rv-virt:knsh64 also hangs at vfork(): https://gist.github.com/lupyuen/ce2e2cb328073d25743adbd4bc4a9b87

i fixed this issue

Copy link
Member

@lupyuen lupyuen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OSTest is now OK on rv-virt:knsh, rv-virt:knsh64 and milkv_duos:nsh thanks!

@acassis acassis merged commit e4a0470 into apache:master Sep 22, 2024
29 checks passed
@lupyuen
Copy link
Member

lupyuen commented Sep 23, 2024

Sorry @hujun260 I think we might have a Race Condition that's intermittently hanging and failing the Signals Test in OSTest. Yesterday Milk-V Duo S SBC (SG2000) tested OK. But today it's hanging:
https://github.com/lupyuen/nuttx-sg2000/releases/tag/nuttx-sg2000-2024-09-23

nsh> ostest
...
user_main: nested signal handler test
signest_test: Starting signal waiter task at priority 101
waiter_main: Waiter started
signest_test: Started waiter_main pid=52
waiter_main: Setting signal mask
signest_test: Starting interfering task at priority 102
waiter_main: Registering signal handler
interfere_main: Waiting on semaphore
waiter_main: Waiting on semaphore
signest_test: Started interfere_main pid=53
[Hangs here]

knsh64 fails the Signal Test with a Segmentation Fault (it was OK yesterday):
https://github.com/lupyuen/nuttx-riscv64/releases/tag/qemu-riscv-knsh64-2024-09-23

$ tools/configure.sh rv-virt:knsh64
...
$ qemu-system-riscv64 -semihosting -M virt,aclint=on -cpu rv64 -kernel nuttx -nographic
QEMU emulator version 9.0.2
OpenSBI v1.4
nsh> ostest
...
user_main: nested signal handler test
signest_test: Starting signal waiter task at priority 101
waiter_main: Waiter started
waiter_main: Setting signal mask
waiter_main: Registering signal handler
waiter_main: Waiting on semaphore
signest_test: Started waiter_main pid=51
signest_test: Starting interfering task at priority 102
interfere_main: Waiting on semaphore
signest_test: Started interfere_main pid=52
signest_test: Simple case:
  Total signalled 1240  Odd=620 Even=620
  Total handled   1240  Odd=620 Even=620
  Total nested    0    Odd=0   Even=0  
[   55.393000] riscv_exception: EXCEPTION: Instruction page fault. MCAUSE: 000000000000000c, EPC: 0000000000000000, MTVAL: 0000000000000000
[   55.393000] riscv_exception: Segmentation fault in PID 10: ostest
ostest_main: Exiting with status 2816

Are you able to reproduce this problem when you re-run knsh64 a few times? Thanks!

@tmedicci
Copy link
Contributor

Hi @hujun260, this PR did not fix the issue introduced by #13561 for esp32c3-generic:knsh:

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x3fcd5820,len:0x16c0
load:0x403cc710,len:0x87c
load:0x403ce710,len:0x2f54
entry 0x403cc710
I (31) boot: ESP-IDF v5.1-dev-3972-g1559b6309f 2nd stage bootloader
I (31) boot: compile time Mar 15 2023 12:14:06
I (32) boot: chip revision: v0.3
I (36) boot.esp32c3: SPI Speed      : 40MHz
I (41) boot.esp32c3: SPI Mode       : DIO
I (46) boot.esp32c3: SPI Flash Size : 4MB
I (50) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (59) boot: ## Label            Usage          Type ST Offset   Length
I (67) boot:  0 factory          factory app      00 00 00010000 00100000
I (74) boot: End of partition table
I (78) esp_image: segment 0: paddr=00010020 vaddr=3c020020 size=0637ch ( 25468) map
I (92) esp_image: segment 1: paddr=000163a4 vaddr=3fc81b8c size=00180h (   384) load
I (95) esp_image: segment 2: paddr=0001652c vaddr=40380000 size=01b8ch (  7052) load
I (105) esp_image: segment 3: paddr=000180c0 vaddr=00000000 size=08038h ( 32824) 
I (119) esp_image: segment 4: paddr=00020100 vaddr=42000100 size=13d78h ( 81272) map
I (138) boot: Loaded app from partition at offset 0x10000
I (138) boot: Disabling RNG early entropy source...
ABCDriscv_exception: EXCEPTION: Instruction access fault. MCAUSE: 00000001, EPC: 00000000, MTVAL: 00000000
riscv_exception: PANIC!!! Exception = 00000001
_assert: Current Version: NuttX  10.4.0 d68fab125e Sep 23 2024 09:29:49 risc-v
_assert: Assertion failed panic: at file: common/riscv_exception.c:132 task: nsh_main process: nsh_main 0x42090918
up_dump_register: EPC: 00b78123
up_dump_register: A0: 80820141 A1: 552987aa A2: c981cb89 A3: 0007d783
up_dump_register: A4: 07c24501 A5: c19c87c1 A6: 80828082 A7: c4221141
up_dump_register: T0: 04330005 T1: f0ef4080 T2: c100a85f T3: 85b2852e
up_dump_register: T4: 92828636 T5: 014140a2 T6: 0073451d
up_dump_register: S0: 40b2547d S1: 44228522 S2: f0efc606 S3: 842afe3f
up_dump_register: S4: 00055863 S5: 40800433 S6: a47ff0ef S7: 547dc100
up_dump_register: S8: 852240b2 S9: 01414422 S10: 11418082 S11: 82aac406
up_dump_register: SP: c606c422 FP: 40b2547d TP: 5863842a RA: 11418082
dump_stacks: ERROR: Stack pointer is not within the stack
dump_stack: IRQ Stack:
dump_stack:   base: 0x3fc825d0
dump_stack:   size: 00002048
stack_dump: 0x3fc82afc: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82b1c: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82b3c: 42003cee 00000000 42003cee 00000000 4200a738 00000000 42003cee 00000000
stack_dump: 0x3fc82b5c: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82b7c: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82b9c: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82bbc: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82bdc: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82bfc: 42003cee 00000000 42003cee 00000000 42003cee 00000000 00000000 00000000
stack_dump: 0x3fc82c1c: 00000000 00b78123 11418082 c606c422 fbdff0ef 5863842a 04330005 f0ef4080
stack_dump: 0x3fc82c3c: c100a85f 40b2547d 44228522 80820141 552987aa c981cb89 0007d783 07c24501
stack_dump: 0x3fc82c5c: c19c87c1 80828082 c4221141 f0efc606 842afe3f 00055863 40800433 a47ff0ef
stack_dump: 0x3fc82c7c: 547dc100 852240b2 01414422 11418082 82aac406 85b2852e 92828636 014140a2
stack_dump: 0x3fc82c9c: 0073451d 00010000 3fc81d64 3fc82cd0 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82cbc: 00000000 00000000 00000000 00000000 00000000 3fc82ca4 3fc82cfc 00000000
stack_dump: 0x3fc82cdc: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82cfc: 3fc82cd0 3fc82d28 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82d1c: 00000000 00000000 00000000 3fc82cfc 3fc82d54 00000000 00000000 00000000
stack_dump: 0x3fc82d3c: 00000000 00000000 00000000 00000000 00000000 00000000 3fc82d28 3fc82d80
stack_dump: 0x3fc82d5c: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82d7c: 00000000 3fc82d54 3fc82dac 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82d9c: 00000000 00000000 00000000 00000000 3fc82d80 3fc82dd8 00000000 00000000
stack_dump: 0x3fc82dbc: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dump_stack: User Stack:
dump_stack:   base: 0x3fc903f0
dump_stack:   size: 00002000
stack_dump: 0x3fc90b1c: 42090000 420063fc 3fc90ba0 deadbeef 00000000 00000000 00000000 00000000
stack_dump: 0x3fc90b3c: 00000000 3fc841c8 42090918 00000001 3fc903d0 3fc903d0 42090918 00000001
stack_dump: 0x3fc90b5c: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc90b7c: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc90b9c: 00000080 00000000 00000000 00000000 420063fc 00000000 00000000 00000000
stack_dump: 0x3fc90bbc: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dump_tasks:    PID GROUP PRI POLICY   TYPE    NPX STATE   EVENT      SIGMASK          STACKBASE  STACKSIZE      USED   FILLED    COMMAND
dump_tasks:   ----   --- --- -------- ------- --- ------- ---------- ---------------- 0x3fc825d0      2048       756    36.9%    irq
dump_task:       0     0   0 FIFO     Kthread - Ready              0000000000000000 0x3fc83510      2032       532    26.1%    Idle_Task
dump_task:       1     1 100 RR       Task    - Running            0000000000000000 0x3fc903f0      2000       164     8.2%    nsh_main

@hujun260
Copy link
Contributor Author

Sorry @hujun260 I think we might have a Race Condition that's intermittently hanging and failing the Signals Test in OSTest. Yesterday Milk-V Duo S SBC (SG2000) tested OK. But today it's hanging: https://github.com/lupyuen/nuttx-sg2000/releases/tag/nuttx-sg2000-2024-09-23

nsh> ostest
...
user_main: nested signal handler test
signest_test: Starting signal waiter task at priority 101
waiter_main: Waiter started
signest_test: Started waiter_main pid=52
waiter_main: Setting signal mask
signest_test: Starting interfering task at priority 102
waiter_main: Registering signal handler
interfere_main: Waiting on semaphore
waiter_main: Waiting on semaphore
signest_test: Started interfere_main pid=53
[Hangs here]

knsh64 fails the Signal Test with a Segmentation Fault (it was OK yesterday): https://github.com/lupyuen/nuttx-riscv64/releases/tag/qemu-riscv-knsh64-2024-09-23

$ tools/configure.sh rv-virt:knsh64
...
$ qemu-system-riscv64 -semihosting -M virt,aclint=on -cpu rv64 -kernel nuttx -nographic
QEMU emulator version 9.0.2
OpenSBI v1.4
nsh> ostest
...
user_main: nested signal handler test
signest_test: Starting signal waiter task at priority 101
waiter_main: Waiter started
waiter_main: Setting signal mask
waiter_main: Registering signal handler
waiter_main: Waiting on semaphore
signest_test: Started waiter_main pid=51
signest_test: Starting interfering task at priority 102
interfere_main: Waiting on semaphore
signest_test: Started interfere_main pid=52
signest_test: Simple case:
  Total signalled 1240  Odd=620 Even=620
  Total handled   1240  Odd=620 Even=620
  Total nested    0    Odd=0   Even=0  
[   55.393000] riscv_exception: EXCEPTION: Instruction page fault. MCAUSE: 000000000000000c, EPC: 0000000000000000, MTVAL: 0000000000000000
[   55.393000] riscv_exception: Segmentation fault in PID 10: ostest
ostest_main: Exiting with status 2816

Are you able to reproduce this problem when you re-run knsh64 a few times? Thanks!

ok i,ll look into this issue

@hujun260
Copy link
Contributor Author

Sorry @hujun260 I think we might have a Race Condition that's intermittently hanging and failing the Signals Test in OSTest. Yesterday Milk-V Duo S SBC (SG2000) tested OK. But today it's hanging: https://github.com/lupyuen/nuttx-sg2000/releases/tag/nuttx-sg2000-2024-09-23

nsh> ostest
...
user_main: nested signal handler test
signest_test: Starting signal waiter task at priority 101
waiter_main: Waiter started
signest_test: Started waiter_main pid=52
waiter_main: Setting signal mask
signest_test: Starting interfering task at priority 102
waiter_main: Registering signal handler
interfere_main: Waiting on semaphore
waiter_main: Waiting on semaphore
signest_test: Started interfere_main pid=53
[Hangs here]

knsh64 fails the Signal Test with a Segmentation Fault (it was OK yesterday): https://github.com/lupyuen/nuttx-riscv64/releases/tag/qemu-riscv-knsh64-2024-09-23

$ tools/configure.sh rv-virt:knsh64
...
$ qemu-system-riscv64 -semihosting -M virt,aclint=on -cpu rv64 -kernel nuttx -nographic
QEMU emulator version 9.0.2
OpenSBI v1.4
nsh> ostest
...
user_main: nested signal handler test
signest_test: Starting signal waiter task at priority 101
waiter_main: Waiter started
waiter_main: Setting signal mask
waiter_main: Registering signal handler
waiter_main: Waiting on semaphore
signest_test: Started waiter_main pid=51
signest_test: Starting interfering task at priority 102
interfere_main: Waiting on semaphore
signest_test: Started interfere_main pid=52
signest_test: Simple case:
  Total signalled 1240  Odd=620 Even=620
  Total handled   1240  Odd=620 Even=620
  Total nested    0    Odd=0   Even=0  
[   55.393000] riscv_exception: EXCEPTION: Instruction page fault. MCAUSE: 000000000000000c, EPC: 0000000000000000, MTVAL: 0000000000000000
[   55.393000] riscv_exception: Segmentation fault in PID 10: ostest
ostest_main: Exiting with status 2816

Are you able to reproduce this problem when you re-run knsh64 a few times? Thanks!

#13585
this pr fixed this issue

@hujun260
Copy link
Contributor Author

Hi @hujun260, this PR did not fix the issue introduced by #13561 for esp32c3-generic:knsh:

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x3fcd5820,len:0x16c0
load:0x403cc710,len:0x87c
load:0x403ce710,len:0x2f54
entry 0x403cc710
I (31) boot: ESP-IDF v5.1-dev-3972-g1559b6309f 2nd stage bootloader
I (31) boot: compile time Mar 15 2023 12:14:06
I (32) boot: chip revision: v0.3
I (36) boot.esp32c3: SPI Speed      : 40MHz
I (41) boot.esp32c3: SPI Mode       : DIO
I (46) boot.esp32c3: SPI Flash Size : 4MB
I (50) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (59) boot: ## Label            Usage          Type ST Offset   Length
I (67) boot:  0 factory          factory app      00 00 00010000 00100000
I (74) boot: End of partition table
I (78) esp_image: segment 0: paddr=00010020 vaddr=3c020020 size=0637ch ( 25468) map
I (92) esp_image: segment 1: paddr=000163a4 vaddr=3fc81b8c size=00180h (   384) load
I (95) esp_image: segment 2: paddr=0001652c vaddr=40380000 size=01b8ch (  7052) load
I (105) esp_image: segment 3: paddr=000180c0 vaddr=00000000 size=08038h ( 32824) 
I (119) esp_image: segment 4: paddr=00020100 vaddr=42000100 size=13d78h ( 81272) map
I (138) boot: Loaded app from partition at offset 0x10000
I (138) boot: Disabling RNG early entropy source...
ABCDriscv_exception: EXCEPTION: Instruction access fault. MCAUSE: 00000001, EPC: 00000000, MTVAL: 00000000
riscv_exception: PANIC!!! Exception = 00000001
_assert: Current Version: NuttX  10.4.0 d68fab125e Sep 23 2024 09:29:49 risc-v
_assert: Assertion failed panic: at file: common/riscv_exception.c:132 task: nsh_main process: nsh_main 0x42090918
up_dump_register: EPC: 00b78123
up_dump_register: A0: 80820141 A1: 552987aa A2: c981cb89 A3: 0007d783
up_dump_register: A4: 07c24501 A5: c19c87c1 A6: 80828082 A7: c4221141
up_dump_register: T0: 04330005 T1: f0ef4080 T2: c100a85f T3: 85b2852e
up_dump_register: T4: 92828636 T5: 014140a2 T6: 0073451d
up_dump_register: S0: 40b2547d S1: 44228522 S2: f0efc606 S3: 842afe3f
up_dump_register: S4: 00055863 S5: 40800433 S6: a47ff0ef S7: 547dc100
up_dump_register: S8: 852240b2 S9: 01414422 S10: 11418082 S11: 82aac406
up_dump_register: SP: c606c422 FP: 40b2547d TP: 5863842a RA: 11418082
dump_stacks: ERROR: Stack pointer is not within the stack
dump_stack: IRQ Stack:
dump_stack:   base: 0x3fc825d0
dump_stack:   size: 00002048
stack_dump: 0x3fc82afc: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82b1c: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82b3c: 42003cee 00000000 42003cee 00000000 4200a738 00000000 42003cee 00000000
stack_dump: 0x3fc82b5c: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82b7c: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82b9c: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82bbc: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82bdc: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82bfc: 42003cee 00000000 42003cee 00000000 42003cee 00000000 00000000 00000000
stack_dump: 0x3fc82c1c: 00000000 00b78123 11418082 c606c422 fbdff0ef 5863842a 04330005 f0ef4080
stack_dump: 0x3fc82c3c: c100a85f 40b2547d 44228522 80820141 552987aa c981cb89 0007d783 07c24501
stack_dump: 0x3fc82c5c: c19c87c1 80828082 c4221141 f0efc606 842afe3f 00055863 40800433 a47ff0ef
stack_dump: 0x3fc82c7c: 547dc100 852240b2 01414422 11418082 82aac406 85b2852e 92828636 014140a2
stack_dump: 0x3fc82c9c: 0073451d 00010000 3fc81d64 3fc82cd0 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82cbc: 00000000 00000000 00000000 00000000 00000000 3fc82ca4 3fc82cfc 00000000
stack_dump: 0x3fc82cdc: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82cfc: 3fc82cd0 3fc82d28 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82d1c: 00000000 00000000 00000000 3fc82cfc 3fc82d54 00000000 00000000 00000000
stack_dump: 0x3fc82d3c: 00000000 00000000 00000000 00000000 00000000 00000000 3fc82d28 3fc82d80
stack_dump: 0x3fc82d5c: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82d7c: 00000000 3fc82d54 3fc82dac 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82d9c: 00000000 00000000 00000000 00000000 3fc82d80 3fc82dd8 00000000 00000000
stack_dump: 0x3fc82dbc: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dump_stack: User Stack:
dump_stack:   base: 0x3fc903f0
dump_stack:   size: 00002000
stack_dump: 0x3fc90b1c: 42090000 420063fc 3fc90ba0 deadbeef 00000000 00000000 00000000 00000000
stack_dump: 0x3fc90b3c: 00000000 3fc841c8 42090918 00000001 3fc903d0 3fc903d0 42090918 00000001
stack_dump: 0x3fc90b5c: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc90b7c: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc90b9c: 00000080 00000000 00000000 00000000 420063fc 00000000 00000000 00000000
stack_dump: 0x3fc90bbc: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dump_tasks:    PID GROUP PRI POLICY   TYPE    NPX STATE   EVENT      SIGMASK          STACKBASE  STACKSIZE      USED   FILLED    COMMAND
dump_tasks:   ----   --- --- -------- ------- --- ------- ---------- ---------------- 0x3fc825d0      2048       756    36.9%    irq
dump_task:       0     0   0 FIFO     Kthread - Ready              0000000000000000 0x3fc83510      2032       532    26.1%    Idle_Task
dump_task:       1     1 100 RR       Task    - Running            0000000000000000 0x3fc903f0      2000       164     8.2%    nsh_main

can you reproduce this issue using qemu?

@tmedicci
Copy link
Contributor

Hi @hujun260, this PR did not fix the issue introduced by #13561 for esp32c3-generic:knsh:

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x3fcd5820,len:0x16c0
load:0x403cc710,len:0x87c
load:0x403ce710,len:0x2f54
entry 0x403cc710
I (31) boot: ESP-IDF v5.1-dev-3972-g1559b6309f 2nd stage bootloader
I (31) boot: compile time Mar 15 2023 12:14:06
I (32) boot: chip revision: v0.3
I (36) boot.esp32c3: SPI Speed      : 40MHz
I (41) boot.esp32c3: SPI Mode       : DIO
I (46) boot.esp32c3: SPI Flash Size : 4MB
I (50) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (59) boot: ## Label            Usage          Type ST Offset   Length
I (67) boot:  0 factory          factory app      00 00 00010000 00100000
I (74) boot: End of partition table
I (78) esp_image: segment 0: paddr=00010020 vaddr=3c020020 size=0637ch ( 25468) map
I (92) esp_image: segment 1: paddr=000163a4 vaddr=3fc81b8c size=00180h (   384) load
I (95) esp_image: segment 2: paddr=0001652c vaddr=40380000 size=01b8ch (  7052) load
I (105) esp_image: segment 3: paddr=000180c0 vaddr=00000000 size=08038h ( 32824) 
I (119) esp_image: segment 4: paddr=00020100 vaddr=42000100 size=13d78h ( 81272) map
I (138) boot: Loaded app from partition at offset 0x10000
I (138) boot: Disabling RNG early entropy source...
ABCDriscv_exception: EXCEPTION: Instruction access fault. MCAUSE: 00000001, EPC: 00000000, MTVAL: 00000000
riscv_exception: PANIC!!! Exception = 00000001
_assert: Current Version: NuttX  10.4.0 d68fab125e Sep 23 2024 09:29:49 risc-v
_assert: Assertion failed panic: at file: common/riscv_exception.c:132 task: nsh_main process: nsh_main 0x42090918
up_dump_register: EPC: 00b78123
up_dump_register: A0: 80820141 A1: 552987aa A2: c981cb89 A3: 0007d783
up_dump_register: A4: 07c24501 A5: c19c87c1 A6: 80828082 A7: c4221141
up_dump_register: T0: 04330005 T1: f0ef4080 T2: c100a85f T3: 85b2852e
up_dump_register: T4: 92828636 T5: 014140a2 T6: 0073451d
up_dump_register: S0: 40b2547d S1: 44228522 S2: f0efc606 S3: 842afe3f
up_dump_register: S4: 00055863 S5: 40800433 S6: a47ff0ef S7: 547dc100
up_dump_register: S8: 852240b2 S9: 01414422 S10: 11418082 S11: 82aac406
up_dump_register: SP: c606c422 FP: 40b2547d TP: 5863842a RA: 11418082
dump_stacks: ERROR: Stack pointer is not within the stack
dump_stack: IRQ Stack:
dump_stack:   base: 0x3fc825d0
dump_stack:   size: 00002048
stack_dump: 0x3fc82afc: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82b1c: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82b3c: 42003cee 00000000 42003cee 00000000 4200a738 00000000 42003cee 00000000
stack_dump: 0x3fc82b5c: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82b7c: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82b9c: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82bbc: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82bdc: 42003cee 00000000 42003cee 00000000 42003cee 00000000 42003cee 00000000
stack_dump: 0x3fc82bfc: 42003cee 00000000 42003cee 00000000 42003cee 00000000 00000000 00000000
stack_dump: 0x3fc82c1c: 00000000 00b78123 11418082 c606c422 fbdff0ef 5863842a 04330005 f0ef4080
stack_dump: 0x3fc82c3c: c100a85f 40b2547d 44228522 80820141 552987aa c981cb89 0007d783 07c24501
stack_dump: 0x3fc82c5c: c19c87c1 80828082 c4221141 f0efc606 842afe3f 00055863 40800433 a47ff0ef
stack_dump: 0x3fc82c7c: 547dc100 852240b2 01414422 11418082 82aac406 85b2852e 92828636 014140a2
stack_dump: 0x3fc82c9c: 0073451d 00010000 3fc81d64 3fc82cd0 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82cbc: 00000000 00000000 00000000 00000000 00000000 3fc82ca4 3fc82cfc 00000000
stack_dump: 0x3fc82cdc: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82cfc: 3fc82cd0 3fc82d28 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82d1c: 00000000 00000000 00000000 3fc82cfc 3fc82d54 00000000 00000000 00000000
stack_dump: 0x3fc82d3c: 00000000 00000000 00000000 00000000 00000000 00000000 3fc82d28 3fc82d80
stack_dump: 0x3fc82d5c: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82d7c: 00000000 3fc82d54 3fc82dac 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc82d9c: 00000000 00000000 00000000 00000000 3fc82d80 3fc82dd8 00000000 00000000
stack_dump: 0x3fc82dbc: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dump_stack: User Stack:
dump_stack:   base: 0x3fc903f0
dump_stack:   size: 00002000
stack_dump: 0x3fc90b1c: 42090000 420063fc 3fc90ba0 deadbeef 00000000 00000000 00000000 00000000
stack_dump: 0x3fc90b3c: 00000000 3fc841c8 42090918 00000001 3fc903d0 3fc903d0 42090918 00000001
stack_dump: 0x3fc90b5c: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc90b7c: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
stack_dump: 0x3fc90b9c: 00000080 00000000 00000000 00000000 420063fc 00000000 00000000 00000000
stack_dump: 0x3fc90bbc: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dump_tasks:    PID GROUP PRI POLICY   TYPE    NPX STATE   EVENT      SIGMASK          STACKBASE  STACKSIZE      USED   FILLED    COMMAND
dump_tasks:   ----   --- --- -------- ------- --- ------- ---------- ---------------- 0x3fc825d0      2048       756    36.9%    irq
dump_task:       0     0   0 FIFO     Kthread - Ready              0000000000000000 0x3fc83510      2032       532    26.1%    Idle_Task
dump_task:       1     1 100 RR       Task    - Running            0000000000000000 0x3fc903f0      2000       164     8.2%    nsh_main

can you reproduce this issue using qemu?

It doesn't make sense to try to reproduce this problem on QEMU: it's a different chip. ESP32-C3 has its own IRQs and memory protection unit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Size: S The size of the change in this PR is small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants